<?php
class Database
{
	static private $_dbh = '';
	
	static public function init()
	{
		if ( self::$_dbh == NULL )
		{
        	try {
				$dns = 'mysql:dbname='.Config::DB_DATABASE.";host=".Config::DB_HOSTNAME;
				$dbh = new PDO( $dns, Config::DB_USERNAME, Config::DB_PASSWORD );
				self::$_dbh = $dbh;
			} catch (PDOException $e) {
				echo 'Connection failed: ' . $e->getMessage();
			}
        }
	}
	
	static public function getDbh()
	{
		return self::$_dbh;
	}
	
	static public function Rdbh()
	{
		
	}
	
	static public function Wdbh()
	{
	
	}
}

//final class DB extends Database{}